package com.huaxin.hxmoduleworkorder.common.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import com.huaxin.hxmoduleworkorder.common.enums.base.BaseCodeEnum;

public enum InspectionReadStatus implements BaseCodeEnum {
    UNREAD("unread", "未读"),
    READ("read", "已读");


    @EnumValue
    private final String code;
    private final String displayName;

    InspectionReadStatus(String code, String displayName) {
        this.code = code;
        this.displayName = displayName;
    }

    @JsonValue
    @Override
    public String getCode() {
        return code;
    }

    @Override
    public String getDisplayName() {
        return displayName;
    }

    public static InspectionReadStatus of(String code) {
        if (code == null) return null;
        for (InspectionReadStatus s : values()) {
            if (s.getCode().equalsIgnoreCase(code)) return s;
        }
        return null;
    }

    public static boolean isValid(String code) {
        return of(code) != null;
    }
}
